using Senparc.Weixin.Entities;
using Senparc.Weixin.MP.CommonAPIs;
using System;
namespace Senparc.Weixin.MP.AdvancedAPIs.MerChant
{
	public static class ShelfApi
	{
		public static AddShelfResult AddShelves(string accessToken, M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, string shelfBanner, string shelfName)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/shelf/add?access_token={0}";
			var data = new
			{
				shelf_data = new
				{
					module_infos = new object[]
					{
						m1,
						m2,
						m3,
						m4,
						m5
					}
				},
				shelf_banner = shelfBanner,
				shelf_name = shelfName
			};
			return CommonJsonSend.Send<AddShelfResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult DeleteShelves(string accessToken, int shelfId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/shelf/del?access_token={0}";
			var data = new
			{
				shelf_id = shelfId
			};
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult ModShelves(string accessToken, M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, int shelfId, string shelfBanner, string shelfName)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/shelf/mod?access_token={0}";
			var data = new
			{
				shelf_id = shelfId,
				shelf_data = new
				{
					module_infos = new object[]
					{
						m1,
						m2,
						m3,
						m4,
						m5
					}
				},
				shelf_banner = shelfBanner,
				shelf_name = shelfName
			};
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static GetAllShelfResult GetAllShelves(string accessToken)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/shelf/getall?access_token=ACCESS_TOKEN";
			return CommonJsonSend.Send<GetAllShelfResult>(accessToken, urlFormat, null, CommonJsonSendType.GET, 10000, false);
		}
		public static GetByIdShelfResult GetByIdShelves(string accessToken, int shelfId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/shelf/getbyid?access_token={0}";
			var data = new
			{
				shelf_id = shelfId
			};
			return CommonJsonSend.Send<GetByIdShelfResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
	}
}
